package com.google.code.alpaca.example.server;

import java.util.Collection;

import com.google.code.alpaca.example.model.Message;
import com.google.code.alpaca.example.rpc.MessagesService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class MessagesServiceImpl extends RemoteServiceServlet implements
    MessagesService {

  private MessageRepository messageRepository = new MessageRepository();

  @Override
  public void create(Message message) {
    messageRepository.create(message);
  }

  @Override
  public void deleteById(Long id) {
    messageRepository.deleteById(id);
  }

  @Override
  public Collection<? extends Message> getAll() {
    return messageRepository.getAll();
  }
}
